<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html">

<ui:composition template="templates/pageTemplate.xhtml">
	<f:metadata>
		<f:viewParam name="registerId" value="#{protocolBean.currentRegister}" />
	</f:metadata>
	<ui:define name="content">
		<h2>#{msgs['title.protocol_of_register']}</h2>
		<h:form>
			<br />
			<p:fieldset legend="#{msgs['title.filter']}" toggleable="true"
				toggleSpeed="500" id="filterForm">
				<h:outputText value="#{msgs['data.id']}:" />
				<p:inputText value="#{protocolBean.filterId}" />
				<br />
				<h:outputText value="#{msgs['data.born_date']}:" />
				<p:calendar showOn="button" value="#{protocolBean.filterBornDate}"
					pattern="dd.MM.yyyy" />
				<br />
				<h:outputText value="#{msgs['data.surname']}:" />
				<p:inputText value="#{protocolBean.filterSurname}" />
				<br />
				<h:outputText value="#{msgs['data.middle_name']}:" />
				<p:inputText value="#{protocolBean.filterMiddlename}" />
				<br />
				<h:outputText value="#{msgs['data.name']}:" />
				<p:inputText value="#{protocolBean.filterName}" />
				<br />
				<h:outputText value="#{msgs['data.birth_certificate_number']}:" />
				<p:inputText value="#{protocolBean.filterBirthCertificateNumber}" />
				<br />
				<h:outputText value="#{msgs['data.result']}:" />
				<h:selectOneMenu id="filterStatus"
					value="#{protocolBean.filterStatus}">
					<f:selectItem itemValue="" itemLabel="#{msgs['data.any']}" />
					<f:selectItems value="#{protocolBean.registerStatuses}"
						var="status" itemValue="#{status}" itemLabel="#{status}" />
				</h:selectOneMenu>
				<br />
				<p:commandButton value="#{msgs['action.apply']}"
					update="tasksList"
					actionListener="#{protocolBean.applyFilter}" />
				<p:commandButton value="#{msgs['action.reset']}"
					update="filterForm, tasksList"
					actionListener="#{protocolBean.resetFilter}" />
			</p:fieldset>
			<p:dataTable var="rcTask" value="#{protocolBean.rcTasks}"
				paginator="true" rows="10" lazy="true"
				paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
				rowsPerPageTemplate="5,10,15" id="tasksList">
				<f:facet name="header">  
                        #{msgs['title.protocol_of_register']}
                </f:facet>
				<p:column headerText="#{msgs['data.id']}" style="width:170px"
					sortBy="#{rcTask.id}">
					<h:outputText value="#{rcTask.id}" />
				</p:column>
				<p:column headerText="#{msgs['data.surname']}" style="width:150px"
					sortBy="#{lastName}">
					<h:outputText value="#{rcTask.lastName}" />
				</p:column>
				<p:column headerText="#{msgs['data.name']}" style="width:150px"
					sortBy="#{rcTask.name}">
					<h:outputText value="#{rcTask.name}" />
				</p:column>
				<p:column headerText="#{msgs['data.born_date']}" style="width:150px"
					sortBy="#{rcTask.bornDate}">
					<h:outputText value="#{rcTask.bornDate}" />
				</p:column>
				<p:column headerText="#{msgs['data.middle_name']}"
					style="width:150px" sortBy="#{rcTask.middleName}">
					<h:outputText value="#{rcTask.middleName}" />
				</p:column>
				<p:column headerText="#{msgs['data.birth_certificate_number']}"
					sortBy="#{rcTask.birthCertificateNumber}" style="width:200px">
					<h:outputText value="#{rcTask.birthCertificateNumber}" />
				</p:column>
				<p:column headerText="#{msgs['data.result']}" style="width:170px"
					sortBy="#{rcTask.status}">
					<h:outputText value="#{rcTask.status}" />
				</p:column>

			</p:dataTable>

			<h:outputLink value="register.jsf">
				<h:outputText value="#{msgs['action.to_register_page']}" />
			</h:outputLink>
		</h:form>
	</ui:define>
</ui:composition>
</html>
